home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / crossword / includes / cwinforeq.i < prev    next >
Encoding:
Text File  |  1980-01-04  |  10.3 KB  |  638 lines

  1.  
  2.  
  3. * This file is for the InfoReq that's put up whenever the
  4. * program is to give User some information. As well as the
  5. * InfoReq structure, there's the routines to access text &
  6. * link them into the IntuiTexts linked to the requester.
  7.  
  8.  
  9. InfoReq:
  10.     dc.l    NULL
  11.     dc.w    0,20
  12.     dc.w    320,160
  13.     dc.w    0,0
  14.     dc.l    NULL        ;gadget ptr
  15.     dc.l    IFB        ;Border ptr
  16.     dc.l    IRT_1        ;text ptr
  17.     dc.w    NOISYREQ        ;Allow mouse button sensing!
  18.     dc.b    4,1
  19.     dc.l    NULL
  20.     dcb.b    32,0
  21.     dc.l    NULL
  22.     dc.l    NULL
  23.     dcb.b    36,0
  24.  
  25.  
  26. * Border
  27.  
  28.  
  29. IFB:
  30.     dc.w    0,0
  31.     dc.b    1,0,RP_JAM1
  32.     dc.b    5
  33.     dc.l    IFBList
  34.     dc.l    NULL
  35.  
  36. IFBList:
  37.     dc.w    0,0
  38.     dc.w    319,0
  39.     dc.w    319,159
  40.     dc.w    0,159
  41.     dc.w    0,0
  42.  
  43.  
  44. * InfoTexts IntuiText structures.
  45.  
  46.  
  47. IRT_1:
  48.     dc.b    8,0,RP_JAM1,0
  49.     dc.w    1,1
  50.     dc.l    NULL        ;font ptr
  51.     dc.l    NULL        ;text pointer 12(An)
  52.     dc.l    NULL        ;ptr to next IRT_ 16(An)
  53.  
  54. ;IRT_2:
  55.     dc.b    1,0,RP_JAM1,0
  56.     dc.w    0,0
  57.     dc.l    NULL
  58.     dc.l    NULL        ;text pointer 12(An)
  59.     dc.l    NULL        ;ptr to next IRT_
  60.  
  61. ;IRT_3:
  62.     dc.b    8,0,RP_JAM1,0
  63.     dc.w    1,1
  64.     dc.l    NULL
  65.     dc.l    NULL        ;text pointer 12(An)
  66.     dc.l    NULL        ;ptr to next IRT_
  67.  
  68. ;IRT_4:
  69.     dc.b    1,0,RP_JAM1,0
  70.     dc.w    0,0
  71.     dc.l    NULL
  72.     dc.l    NULL        ;text pointer 12(An)
  73.     dc.l    NULL        ;ptr to next IRT_
  74.  
  75. ;IRT_3:
  76.     dc.b    8,0,RP_JAM1,0
  77.     dc.w    1,1
  78.     dc.l    NULL
  79.     dc.l    NULL        ;text pointer 12(An)
  80.     dc.l    NULL        ;ptr to next IRT_
  81.  
  82. ;IRT_4:
  83.     dc.b    1,0,RP_JAM1,0
  84.     dc.w    0,0
  85.     dc.l    NULL
  86.     dc.l    NULL        ;text pointer 12(An)
  87.     dc.l    NULL        ;ptr to next IRT_
  88.  
  89. ;IRT_3:
  90.     dc.b    8,0,RP_JAM1,0
  91.     dc.w    1,1
  92.     dc.l    NULL
  93.     dc.l    NULL        ;text pointer 12(An)
  94.     dc.l    NULL        ;ptr to next IRT_
  95.  
  96. ;IRT_4:
  97.     dc.b    1,0,RP_JAM1,0
  98.     dc.w    0,0
  99.     dc.l    NULL
  100.     dc.l    NULL        ;text pointer 12(An)
  101.     dc.l    NULL        ;ptr to next IRT_
  102.  
  103. ;IRT_3:
  104.     dc.b    8,0,RP_JAM1,0
  105.     dc.w    1,1
  106.     dc.l    NULL
  107.     dc.l    NULL        ;text pointer 12(An)
  108.     dc.l    NULL        ;ptr to next IRT_
  109.  
  110. ;IRT_4:
  111.     dc.b    1,0,RP_JAM1,0
  112.     dc.w    0,0
  113.     dc.l    NULL
  114.     dc.l    NULL        ;text pointer 12(An)
  115.     dc.l    NULL        ;ptr to next IRT_
  116.  
  117. ;IRT_3:
  118.     dc.b    8,0,RP_JAM1,0
  119.     dc.w    1,1
  120.     dc.l    NULL
  121.     dc.l    NULL        ;text pointer 12(An)
  122.     dc.l    NULL        ;ptr to next IRT_
  123.  
  124. ;IRT_4:
  125.     dc.b    1,0,RP_JAM1,0
  126.     dc.w    0,0
  127.     dc.l    NULL
  128.     dc.l    NULL        ;text pointer 12(An)
  129.     dc.l    NULL        ;ptr to next IRT_
  130.  
  131. ;IRT_3:
  132.     dc.b    8,0,RP_JAM1,0
  133.     dc.w    1,1
  134.     dc.l    NULL
  135.     dc.l    NULL        ;text pointer 12(An)
  136.     dc.l    NULL        ;ptr to next IRT_
  137.  
  138. ;IRT_4:
  139.     dc.b    1,0,RP_JAM1,0
  140.     dc.w    0,0
  141.     dc.l    NULL
  142.     dc.l    NULL        ;text pointer 12(An)
  143.     dc.l    NULL        ;ptr to next IRT_
  144.  
  145. ;IRT_3:
  146.     dc.b    8,0,RP_JAM1,0
  147.     dc.w    1,1
  148.     dc.l    NULL
  149.     dc.l    NULL        ;text pointer 12(An)
  150.     dc.l    NULL        ;ptr to next IRT_
  151.  
  152. ;IRT_4:
  153.     dc.b    1,0,RP_JAM1,0
  154.     dc.w    0,0
  155.     dc.l    NULL
  156.     dc.l    NULL        ;text pointer 12(An)
  157.     dc.l    NULL        ;ptr to next IRT_
  158.  
  159. ;IRT_3:
  160.     dc.b    8,0,RP_JAM1,0
  161.     dc.w    1,1
  162.     dc.l    NULL
  163.     dc.l    NULL        ;text pointer 12(An)
  164.     dc.l    NULL        ;ptr to next IRT_
  165.  
  166. ;IRT_4:
  167.     dc.b    1,0,RP_JAM1,0
  168.     dc.w    0,0
  169.     dc.l    NULL
  170.     dc.l    NULL        ;text pointer 12(An)
  171.     dc.l    NULL        ;ptr to next IRT_
  172.  
  173. ;IRT_3:
  174.     dc.b    8,0,RP_JAM1,0
  175.     dc.w    1,1
  176.     dc.l    NULL
  177.     dc.l    NULL        ;text pointer 12(An)
  178.     dc.l    NULL        ;ptr to next IRT_
  179.  
  180. ;IRT_4:
  181.     dc.b    1,0,RP_JAM1,0
  182.     dc.w    0,0
  183.     dc.l    NULL
  184.     dc.l    NULL        ;text pointer 12(An)
  185.     dc.l    NULL        ;ptr to next IRT_
  186.  
  187.  
  188. * LinkInfoText(a6)
  189. * a6 = ptr to main program variables
  190.  
  191. * Link texts described by the irt_ arguments
  192. * into the InfoReq IntuiTexts. This to be done
  193. * ALWAYS before popping up the requester.
  194.  
  195. * NOTE : each text is popped into TWO consecutive IntuiTexts.
  196. * The first is the brown background text, the second is the
  197. * main white text (using the colours in the CrossWord.s main
  198. * colour map). This assumes that there is always an even no.
  199. * of ITexts. At the moment there are 20 of them. Colour and
  200. * jam mode info is fixed for now.
  201.  
  202.  
  203. * d0-d4/a0-a2 corrupt
  204.  
  205.  
  206. LinkInfoText    move.l    irt_itext(a6),a0        ;ptr to InfoReq ITexts
  207.  
  208.         move.l    irt_tlist(a6),a1        ;ptr to my text list
  209.  
  210.         move.w    irt_count(a6),d0        ;no. to insert
  211.  
  212. LITxt_1        move.w    (a1)+,d1            ;get position info
  213.         move.w    (a1)+,d2            ;from my text list
  214.  
  215.         move.w    d1,d3            ;copy positions
  216.         move.w    d2,d4
  217.  
  218.         addq.w    #1,d3            ;first position is
  219.         addq.w    #1,d4            ;displaced slightly
  220.  
  221.         move.l    a1,12(a0)        ;insert text ptr
  222.  
  223.         move.w    d3,4(a0)            ;pop in position
  224.         move.w    d4,6(a0)            ;info
  225.  
  226.         lea    20(a0),a2        ;ptr to next IText
  227.         move.l    a2,16(a0)        ;and connect them up
  228.  
  229.         move.l    a2,a0            ;point to next IText
  230.  
  231.         move.l    a1,12(a0)        ;insert text ptr
  232.  
  233.         move.w    d1,4(a0)            ;pop in position
  234.         move.w    d2,6(a0)            ;info
  235.  
  236.         lea    20(a0),a2        ;ptr to next IText
  237.         move.l    a2,16(a0)        ;and connect them up
  238.  
  239. LITxt_3        tst.b    (a1)+            ;scan until next
  240.         bne.s    LITxt_3            ;text reached
  241.  
  242.         move.l    a1,d1            ;check for true
  243.         and.b    #1,d1            ;even alignment
  244.         beq.s    LITxt_4            ;after text scan
  245.  
  246.         addq.l    #1,a1            ;here ensure even!
  247.  
  248. LITxt_4        subq.w    #1,d0            ;done them all?
  249.         beq.s    LITxt_2            ;skip if so
  250.  
  251.         move.l    a2,a0            ;point to next
  252.         bra.s    LITxt_1
  253.  
  254. LITxt_2        clr.l    16(a0)            ;signal last IText
  255.  
  256.         rts
  257.  
  258.  
  259. * ShowInfoReq(a6)
  260. * a6 = ptr to main program variables
  261.  
  262. * Display the InfoRequester until any mouse button pressed.
  263. * This requester needs to be a NOISYREQ requester to allow
  264. * mouse button sensing.
  265.  
  266. * d0-d1/a0-a1 corrupt
  267.  
  268.  
  269. ShowInfoReq    move.l    mw_handle(a6),a0    ;kill off IDCMPs for now
  270.  
  271.         moveq    #MOUSEBUTTONS+MOUSEMOVE,d0    ;except these
  272.  
  273.         CALLINT    ModifyIDCMP
  274.  
  275.         lea    InfoReq(pc),a0
  276.         move.l    mw_handle(a6),a1
  277.  
  278.         CALLINT    Request        ;pop up requester
  279.  
  280.         bset    #0,applic_flag2(a6)
  281.  
  282. SIR_L1        move.l    mw_userport(a6),a0
  283.         lea    ehb_info(pc),a5
  284.         bsr    DoEvent
  285.  
  286.         btst    #0,applic_flag2(a6)    ;finished?
  287.         bne.s    SIR_L1
  288.  
  289.         lea    InfoReq(pc),a0
  290.         move.l    mw_handle(a6),a1
  291.  
  292.         CALLINT    EndRequest    ;kill the requester
  293.  
  294.         move.l    mw_handle(a6),a0
  295.         move.l    mw_IDCMP(a6),d0
  296.  
  297.         CALLINT    ModifyIDCMP    ;& recover old IDCMP
  298.  
  299.         rts
  300.  
  301.  
  302. * ShowDiscInfo(a6)
  303. * a6 = ptr to main program variables
  304.  
  305. * Alternative InfoReq using a window for the Disc Access Panel.
  306. * Used because standard one hiccups.
  307.  
  308. * Call with the correct irt_ variables preset!
  309.  
  310. * d0-d1/a0-a1 corrupt
  311.  
  312.  
  313. ShowDiscInfo    lea    DiscWindow3(pc),a0
  314.         move.l    ms_handle(a6),d0
  315.         move.l    d0,30(a0)
  316.         CALLINT    OpenWindow
  317.         move.l    d0,dp_window3(a6)        ;got window?
  318.         beq    SDI_B1            ;skip if not
  319.  
  320.         move.l    d0,a0
  321.         move.l    UserPort(a0),di_userport(a6)
  322.         move.l    RastPort(a0),a1
  323.         move.l    a1,di_rastport(a6)    ;now set green
  324.         moveq    #4,d0            ;background
  325.         CALLGRAF    SetRast
  326.  
  327.         bsr    LinkInfoText        ;pop in info text
  328.  
  329.         move.l    di_rastport(a6),a0
  330.         lea    IFB(pc),a1
  331.         moveq    #0,d0
  332.         move.l    d0,d1
  333.  
  334.         CALLINT    DrawBorder        ;draw the border
  335.  
  336.         move.l    irt_itext(a6),a1
  337.         move.l    di_rastport(a6),a0
  338.         moveq    #0,d0
  339.         move.l    d0,d1
  340.  
  341.         CALLINT    PrintIText        ;print the text
  342.  
  343.         bset    #0,applic_flag2(a6)
  344.         bset    #2,applic_flag2(a6)    ;set holding flag
  345.  
  346. SDI_L1        move.l    di_userport(a6),a0
  347.         lea    ehb_info(pc),a5
  348.         bsr    DoEvent
  349.  
  350.         btst    #0,applic_flag2(a6)    ;finished?
  351.         bne.s    SDI_L1            ;back if not
  352.  
  353.         move.l    dp_window3(a6),a0        ;get rid of the
  354.         CALLINT    CloseWindow        ;window
  355.  
  356. SDI_B1        bra    ShowDir
  357.  
  358.         rts
  359.  
  360.  
  361. * ExitInfo(a6)
  362. * a6 = ptr to main program variables
  363. * signal exiting the InfoRequester
  364.  
  365. * If holding required, caller must set bit 2
  366. * of applic_flag2 prior to entry.
  367.  
  368. * d0 corrupt
  369.  
  370. ExitInfo        move.w    menu_id(a6),d0        ;check for button
  371.         cmp.w    #SELECTUP,d0        ;released &
  372.         beq.s    EIF_1            ;skip if so
  373.         cmp.w    #MENUUP,d0
  374.         beq.s    EIF_1
  375.  
  376.         bclr    #2,applic_flag2(a6)    ;clear hold flag
  377.  
  378.         rts
  379.  
  380. EIF_1        bclr    #2,applic_flag2(a6)    ;holding?
  381. ;        btst    #2,applic_flag2(a6)    ;holding?
  382.         bne.s    EIF_2
  383.  
  384.         bclr    #0,applic_flag2(a6)
  385. EIF_2        rts
  386.  
  387.  
  388. * Following routines to do with HELP function.
  389.  
  390.  
  391. * ToggleHelp(a6)
  392. * a6 = ptr to main program variables
  393. * Turn HELP function on or off according to each
  394. * press of the HELP key.
  395.  
  396. * d0-d2/a0-a2 corrupt
  397.  
  398.  
  399. ToggleHelp    lea    IRT_1(pc),a0
  400.  
  401.         bchg    #1,applic_flag2(a6)    ;toggle help flag
  402.         bne.s    THelp_1            ;was on, now off.
  403.  
  404.         lea    Help_On(pc),a1
  405.         moveq    #7,d0
  406.         bra.s    THelp_2
  407.  
  408. THelp_1        lea    Help_Off(pc),a1
  409.         moveq    #3,d0
  410.  
  411. THelp_2        move.l    a0,irt_itext(a6)
  412.         move.l    a1,irt_tlist(a6)
  413.         move.w    d0,irt_count(a6)
  414.  
  415.         bsr    LinkInfoText
  416.  
  417.         bsr    ShowInfoReq
  418.  
  419.         btst    #1,applic_flag2(a6)    ;HELP now on?
  420.         beq.s    THelp_Done
  421.  
  422.         lea    IRT_1(pc),a0
  423.         lea    Help_On2(pc),a1
  424.         moveq    #8,d0
  425.  
  426.         move.l    a0,irt_itext(a6)
  427.         move.l    a1,irt_tlist(a6)
  428.         move.w    d0,irt_count(a6)
  429.  
  430.         bsr    LinkInfoText
  431.  
  432.         bsr    ShowInfoReq
  433.  
  434. THelp_Done    rts
  435.  
  436.  
  437. * HandleKey(a6)
  438. * a6 = ptr to main program variables
  439. * Handle RAWKEY events. Copies IntuiMessage
  440. * data to an InputEvent structure for use by
  441. * RawKeyConvert() if the key isn't one of our
  442. * special keys.
  443.  
  444. * d0-d2/a0-a2 corrupt
  445.  
  446.  
  447. HandleKey    nop
  448.  
  449.         move.w    menu_id(a6),d0    ;get key press
  450.         cmp.w    #$5F,d0        ;HELP key?
  451.         bne.s    HKey_B1        ;skip if not
  452.  
  453.         bra    ToggleHelp    ;else set Help Mode
  454.  
  455.         rts
  456.  
  457. HKey_B1        lea    IRT_1(pc),a0
  458.         move.l    a0,irt_itext(a6)
  459.  
  460.         cmp.w    #$50,d0        ;F1 key?
  461.         bne.s    HKey_B2
  462.  
  463.         lea    HelpF1_1(pc),a1
  464.         moveq    #7,d0
  465.  
  466.         move.l    a1,irt_tlist(a6)
  467.         move.w    d0,irt_count(a6)
  468.  
  469.         bsr    LinkInfoText
  470.  
  471.         bsr    ShowInfoReq
  472.  
  473.         lea    HelpF1_2(pc),a1
  474.         moveq    #6,d0
  475.  
  476.         move.l    a1,irt_tlist(a6)
  477.         move.w    d0,irt_count(a6)
  478.  
  479.         bsr    LinkInfoText
  480.  
  481.         bsr    ShowInfoReq
  482.  
  483.         rts
  484.  
  485.  
  486. HKey_B2        cmp.w    #$51,d0        ;F2 key?
  487.         bne.s    HKey_B3
  488.  
  489.         lea    HelpF2_1(pc),a1
  490.         moveq    #8,d0
  491.  
  492.         move.l    a1,irt_tlist(a6)
  493.         move.w    d0,irt_count(a6)
  494.  
  495.         bsr    LinkInfoText
  496.  
  497.         bsr    ShowInfoReq
  498.  
  499.         lea    HelpF2_2(pc),a1
  500.         moveq    #8,d0
  501.  
  502.         move.l    a1,irt_tlist(a6)
  503.         move.w    d0,irt_count(a6)
  504.  
  505.         bsr    LinkInfoText
  506.  
  507.         bsr    ShowInfoReq
  508.  
  509.         lea    HelpF2_3(pc),a1
  510.         moveq    #6,d0
  511.  
  512.         move.l    a1,irt_tlist(a6)
  513.         move.w    d0,irt_count(a6)
  514.  
  515.         bsr    LinkInfoText
  516.  
  517.         bsr    ShowInfoReq
  518.  
  519.         lea    HelpF2_4(pc),a1
  520.         moveq    #4,d0
  521.  
  522.         move.l    a1,irt_tlist(a6)
  523.         move.w    d0,irt_count(a6)
  524.  
  525.         bsr    LinkInfoText
  526.  
  527.         bsr    ShowInfoReq
  528.  
  529.         rts
  530.  
  531. HKey_B3        cmp.w    #$52,d0        ;F3 key?
  532.         bne.s    HKey_B4
  533.  
  534.         lea    HelpF3_1(pc),a1
  535.         moveq    #6,d0
  536.  
  537.         move.l    a1,irt_tlist(a6)
  538.         move.w    d0,irt_count(a6)
  539.  
  540.         bsr    LinkInfoText
  541.  
  542.         bsr    ShowInfoReq
  543.  
  544.         lea    HelpF3_2(pc),a1
  545.         moveq    #7,d0
  546.  
  547.         move.l    a1,irt_tlist(a6)
  548.         move.w    d0,irt_count(a6)
  549.  
  550.         bsr    LinkInfoText
  551.  
  552.         bsr    ShowInfoReq
  553.  
  554.         lea    HelpF3_3(pc),a1
  555.         moveq    #6,d0
  556.  
  557.         move.l    a1,irt_tlist(a6)
  558.         move.w    d0,irt_count(a6)
  559.  
  560.         bsr    LinkInfoText
  561.  
  562.         bsr    ShowInfoReq
  563.  
  564.         rts
  565.  
  566. HKey_B4        cmp.w    #$53,d0        ;F4 key?
  567.         bne.s    HKey_B5
  568.  
  569.         lea    HelpF4_1(pc),a1
  570.         moveq    #7,d0
  571.  
  572.         move.l    a1,irt_tlist(a6)
  573.         move.w    d0,irt_count(a6)
  574.  
  575.         bsr    LinkInfoText
  576.  
  577.         bsr    ShowInfoReq
  578.  
  579.         rts
  580.  
  581. HKey_B5        cmp.w    #$54,d0        ;F5 key?
  582.         bne.s    HKey_B6
  583.  
  584.         lea    HelpF5_1(pc),a1
  585.         moveq    #7,d0
  586.  
  587.         move.l    a1,irt_tlist(a6)
  588.         move.w    d0,irt_count(a6)
  589.  
  590.         bsr    LinkInfoText
  591.  
  592.         bsr    ShowInfoReq
  593.  
  594. HKey_B6        rts
  595.  
  596. HKey_Done    rts
  597.  
  598.  
  599. * Here copy IntuiMessage data to InputEvent structure
  600.  
  601.  
  602.         nop
  603.  
  604.  
  605. * Here do a RawKeyConvert() to get a key press if it isn't one
  606. * of our special keys.
  607.  
  608.  
  609.         lea    CW_IE(pc),a0
  610.         lea    iebuffer(pc),a1
  611.         moveq    #10,d1
  612.         sub.l    a2,a2
  613.  
  614.         move.l    a6,-(sp)
  615.         move.l    consoledev(a6),a6
  616.         jsr    RawKeyConvert(a6)
  617.         move.l    (sp)+,a6
  618.  
  619.         rts
  620.  
  621.  
  622. * InputEvent structure for use with above
  623.  
  624.  
  625. CW_IE        dc.l    0
  626.         dc.b    0,0    ;class, subclass
  627.         dc.w    0    ;code
  628.         dc.w    0    ;qualifier
  629.         dc.l    0    ;eventaddr
  630.         dc.l    0,0    ;timestamp
  631.  
  632. iebuffer        ds.b    10    ;10 byte convert buffer
  633.  
  634.  
  635.  
  636.  
  637.  
  638.